<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="page" uri="/page-taglib"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
//String path = request.getContextPath();
//String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";


String path = request.getContextPath();
//取得文件所在的文件夹，并且取得最后一个 "/" 的部分
String path1 = request.getServletPath();
int i = path1.lastIndexOf("/");
String path2 = path1.substring(0,i);

String basePath = request.getScheme() + "://"  
        + request.getServerName() + ":" + request.getServerPort()   
        + path + path2 + "/";  
        
String departmentid = (String)request.getParameter("departmentid");

//request.setAttribute("departmentid" , departmentid);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<title>标准托管系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


<!-- 引入jQuery -->
<!--表格样式定义，支持 jquery-ui 中的所有 themes-->
<link rel="stylesheet" type="text/css" media="screen" href="../jqgrid/jquery-ui/themes/smoothness/jquery-ui-1.7.2.custom.css"/>
<!--jqgrid 中，定义 themes 的样式在版本3.6.2 中，引入 src/css/ui.jqgrid.css 搜索显示不正常. 可能 src 中的文件都不可以用，仅是源码-->
<link rel="stylesheet" type="text/css" media="screen" href="../jqgrid/jqgrid_src/css/ui.jqgrid.css"/>

<link rel="stylesheet" type="text/css" href="../stylesheet/styles.css">
<!--
 Since the jQuery UI Themes have different font sizes it is a good idea to reduce the font size. This can be done using the style tag in the same file.
-->
<!--由于 jquery-ui 的问题，字体显示不一，故加入该样式-->
<style>
html, body {
	margin: 5px;
	padding: 5px;
	font-size: 120%;
}

body {
	margin-top: 1px;
}

a:link {
	color: #316AC5;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #316AC5;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}

</style>
<!--引入相关 js 文件，引入顺序不能变-->
<script src="../jqgrid/jqgrid_src/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../jqgrid/jquery-ui/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="../jqgrid/jqgrid_src/js/i18n/grid.locale-cn.js" type="text/javascript"></script>
<script src="../jqgrid/jqgrid_src/js/jquery.jqGrid.min.js" type="text/javascript"></script>

<!-- 开始定义执行函数-->
<script type="text/javascript">

$(function()  
{  

     $("#gridTable").jqGrid({  
       url:'../jq/showListBydepartmentAction.action?departmentid=<%=departmentid%>', //数据来源
        datatype: "json", 	
		editurl:"../jq/editAction.action",//编辑后，提交地址.

        height: 350,
        mtype: 'POST',
       // rownumbers true,//指定是否给显示从1开始的编号
	   
        colNames:['序号','托管标准号','标准名称', '文本', '实施日期', '修改单','类别','语种','所属部门','登记日期','备注'],
        
        //可以对 colModel 中的参数进行格式化，包括样式,是否可编辑,修改是验证
        colModel:[
            {name:'NUM',index:'NUM', width:35, align:'center',sorttype:"int",search:false,stype:'text',editable:false,editoptions:{readonly:true,size:10}},
            {name:'ST_STANDARDCODE',index:'ST_STANDARDCODE', width:120,align:'center',sorttype:"string",editable:true,editrules:{required:true},search:true,searchoptions:{sopt:["eq","ne","cn","nc"]}},
            {name:'ST_STANDARD_NAME',index:'ST_STANDARD_NAME', width:60, align:'center',sorttype:"string",search:false,editable:false},
			{name:'ST_STANDARD_TEXT_ADDRESS',index:'ST_STANDARD_TEXT_ADDRESS',width:60,align:'center',sorttype:"string",search:false,editable:false,formatter:'showlink',formatoptions:{baseLinkUrl:'../downLoadFileAction.action',target:'_blank',addParam: '&action=bydepartmentfile', idName:'id'}},
            {name:'ST_STANDARD_ACT_TIME',index:'ST_STANDARD_ACT_TIME', width:90,align:'center',sorttype:"string",search:false,editable:false},
            // 格式化的例子，添加链接
            //http://localhost/someurl.php?id=123&action=edit
            {name:'stModifySum',index:'stModifySum',width:50,align:'center',sorttype:"string",search:false,editable:false,formatter:'showlink',formatoptions:{baseLinkUrl:'../downLoadFileAction.action',target:'_blank',addParam: '&action=bydepartmentmodify', idName:'id'}},
            {name:'ZHIJS_TYPENAME',index:'ZHIJS_TYPENAME', width:60,align:'center',sorttype:"string",search:false,editable:true,edittype:'select',editoptions:{value:{1:'标准',2:'公告',3:'规程/规范',4:'认证文件'}}},
            {name:'ZHIJS_LANGUAGE_NAME',index:'ZHIJS_LANGUAGE_NAME', width:50, align:'center',search:false,editable:true,edittype:'select',editoptions:{value:{cn:'中文',en:'英文',de:'德文',jp:'日文'}} },
            {name:'ZHIJS_DEPARTMENT',index:'ZHIJS_DEPARTMENT', width:60,align:'center',search:false,editable:true,edittype:'select',editoptions:{value:{1:'食品室',2:'安全室',3:'电线室',4:'电磁室',5:'乐器室',6:'信息室',7:'眼镜室',8:'日化室',9:'空气室',10:'ROHS 室',11:'食品化工室'}}},
            {name:'ST_LASTUPDATE',index:'ST_LASTUPDATE', width:100, id:'ACTION',align:'center', sorttype:"string",search:false,editable:false},
            {name:'ST_REMARK',index:'ST_REMARK', width:60, align:'center',sorttype:"string",search:false,editable:true}
        ],
        pager:"#gridPager",  //分页工具栏显示位置
        sortname:'NUM', //默认排序字段
        sortorder:'asc', //(asc,desc) 点击 jqgrid 刷新工具，默认的排序规则
        viewrecords:true,  //定义是否在导航条上显示总的记录数
        rowNum:15,//传到服务器端的参数,对于请求参数 rows
        rowList:[15,25,35],
        emptyrecords:'无结果',//当返回的数据行数为0时显示的信息。只有当属性 viewrecords 设置为ture时起作用

     	jsonReader: {
				root:"dataRows",		// 保存 json 数据的集合（默认为：rows）
				page: "curPageNo",  	// 当前页（默认为：page）
				total: "totalPages",  // 总页数（默认为：total）
				records: "totalRecords",  // 总记录数（默认为：records）
				repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
       prmNames:{page:"page.pageNo",rows:"page.pageSize", sort: "page.orderBy", order: "page.order", search:"search", nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del"},

	   caption: "标准托管系统 部门标准列表"
	 
	}).navGrid('#gridPager',{edit:true,add:true,del:true,search:true,view:true,refresh:true},
	{closeOnEscape:true}, // settings for edit   
	{closeOnEscape:true}, // settings for add   
	{closeOnEscape:true},  // delete instead that del:false we need this   
	{closeOnEscape:true}, // search options  
	{closeOnEscape:true} // view parameters 

	//closeOnEscape:true ,  allow the view dialog to be closed when user press ESC key

);//jqGrid的格式化是定义在语言包中


})  

</script>

<script type="text/javascript">
    $(document).ready(
         function(){   
              	 $("#ACTION").click(updatefunction);   
             }
         );  

         function updatefunction(){   
             return(confirm("更新托管标准为 '最新标准' 吗?"));
         }  
</script>

</head>
<body>
<div id="wrap">

  <div ><img src="../images/top.jpg" width="920" height="100" /></div>
  
  <div id="content">
    <table id="gridTable"></table>
<div id="gridPager"></div>

<p class="box"><strong>备注:</strong> <br/>
本托管系统是根据首都标准网收集的信息，列出托管标准的更新情况，结果仅作为一种参考，实际应用时应该再次核对。</p>
 
</div>

<jsp:include page="include/sidebar.jsp"></jsp:include>
<jsp:include page="include/footer.jsp"></jsp:include>
</div>
</body>
</html>